/*! lzf */

if (0 < $("#float").length) {
    var float_obj = $("#float"), offsetTop = float_obj.offset().top;
    window.onscroll = function () {
        offsetTop < $(document).scrollTop() ? (float_obj.css("position", "fixed"), float_obj.css("top", "0px")) : float_obj.css("position", "relative")
    }
}

function Event(t) {
    var i = [];
    this.getName = function () {
        return t
    }, this.addHandler = function (t) {
        i.push(t)
    }, this.removeHandler = function (t) {
        for (var n = 0; n < i.length; n++) if (i[n] == t) {
            i.splice(n, 1);
            break
        }
    }, this.fire = function (n) {
        i.forEach(function (t) {
            t(n)
        })
    }
}

function EventAggregator() {
    var e = [];

    function o(n) {
        return $.grep(e, function (t) {
            return t.getName() === n
        })[0]
    }

    this.publish = function (t, n) {
        var i = o(t);
        i || (i = new Event(t), e.push(i)), i.fire(n)
    }, this.subscribe = function (t, n) {
        var i = o(t);
        i || (i = new Event(t), e.push(i)), i.addHandler(n)
    }
}

function BuildingListController(t, n) {
    var i = t.getTarget();
    n.subscribe("labelClick", function (t) {
        var n = $("#poi" + t.point.index).offset().top;
        $("html,body").animate({scrollTop: n})
    }), i.mouseover(function () {
        n.publish("buildingListMouseOver", {index: $(this).attr("data-num")})
    }).mouseout(function () {
        n.publish("buildingListMouseOut", {index: $(this).attr("data-num")})
    })
}

function MapRepository() {
    var n, i = [], t = $(".building-item");
    t.each(function (t) {
        n = {lng: $(this).attr("lng"), lat: $(this).attr("lat"), index: t + 1}, i.push(n)
    }), this.getPoints = function () {
        return i
    }, this.getTarget = function () {
        return t
    }
}

function MapController(t, n) {
    var i, e, o, a, r, s = t.getPoints(), l = [], u = [];

    function f() {
        var t = $(this).attr("data-num") - 1;
        n.publish("labelClick", {point: s[t]})
    }

    0 !== s.length && (n.subscribe("buildingListMouseOver", function (t) {
        $(u[t.index - 1]).addClass("map-active-mark" + t.index)
    }), n.subscribe("buildingListMouseOut", function (t) {
        $(u[t.index - 1]).removeClass("map-active-mark" + t.index)
    }), (a = new BMap.Map("right_map", {enableMapClick: !1})).addControl(new BMap.NavigationControl({type: BMAP_NAVIGATION_CONTROL_ZOOM})), a.disableScrollWheelZoom(), a.disableInertialDragging(!0), s.forEach(function (t) {
        i = new BMap.Point(t.lng, t.lat), e = {
            point: i,
            className: "map-mark" + t.index,
            offsetX: "10.5",
            offsetY: "33",
            num: t.index
        }, o = new MyLabel(e), a.addOverlay(o), o._div.onclick = f, l.push(i), u.push(o._div)
    }), r = a.getViewport(l, {enableAnimation: !0, margins: [10, 10, 10, 10]}), a.centerAndZoom(r.center, r.zoom))
}